package com.sh.杂七杂八;

import java.util.HashMap;
import java.util.Hashtable;

public class Main {
    public static void main(String[] args) {
        // HashMap 示例
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("key1", "value1");
        hashMap.put(null, "value2"); // 允许 null 键
        System.out.println("HashMap: " + hashMap);

        // Hashtable 示例
        Hashtable<String, String> hashtable = new Hashtable<>();
        hashtable.put("key1", "value1");
//         hashtable.put(null, "value2"); // 不允许 null 键，会抛出 NullPointerException
        System.out.println("Hashtable: " + hashtable);
    }
}
